package com.turing.post.account.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;
/**
 * 帐户子系统特殊交易登记薄
 * @author ZXL
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "AccountSystemSpecialRegister")
@IdClass(AccountSystemSpecialRegister.class)
public class AccountSystemSpecialRegister implements Serializable {

	public AccountSystemSpecialRegister() {
		super();
	}

	/**
	 * 帐户子系统流水号
	 */
	private String RegSeqNo = null;

	@Id
	@Column(name = "RegSeqNo", nullable = false)	
	public String getRegSeqNo() {
		return this.RegSeqNo;
	}

	public void setRegSeqNo(String RegSeqNo) {
		this.RegSeqNo = RegSeqNo;
	}

	/**
	 * 主帐号
	 */
	private BigInteger MasterAccNo = null;

	@Id
	@Column(name = "MasterAccNo", nullable = false)
	public BigInteger getMasterAccNo() {
		return this.MasterAccNo;
	}

	public void setMasterAccNo(BigInteger masterAccNo) {
		this.MasterAccNo = masterAccNo;
	}

	/**
	 * 卡号
	 */
	private String CardNo = null;

	@Column(name = "CardNo", nullable = true)
	public String getCardNo() {
		return CardNo;
	}

	public void setCardNo(String cardNo) {
		CardNo = cardNo;
	}

	/**
	 * 余额
	 */
	private BigInteger Balance = null;

	@Column(name = "Balance", nullable = false)	
	public BigInteger getBalance() {
		return Balance;
	}

	public void setBalance(BigInteger balance) {
		Balance = balance;
	}

	/**
	 * 发卡商
	 */
	private String IssueCompanyNo = null;
	
	@Column(name = "IssueCompanyNo", nullable = false)
	public String getIssueCompanyNo() {
		return IssueCompanyNo;
	}

	public void setIssueCompanyNo(String issueCompanyNo) {
		IssueCompanyNo = issueCompanyNo;
	}

	/**
	 * 交易时间
	 */
	private Date TranTime = null;
	
	@Column(name = "TranTime", nullable = false)
	public Date getTranTime() {
		return TranTime;
	}

	public void setTranTime(Date tranTime) {
		TranTime = tranTime;
	}

	/**
	 * 交易类型
	 */
	private String TranType = null;

	/**
	 * 止付
	 */
	public final static String ACCOUNTSYSTEMSPECIALREGISTER_STOPPAYMENT = "00";

	/**
	 * 解止付
	 */
	public final static String ACCOUNTSYSTEMSPECIALREGISTER_STOPPAYMENT_FREE = "10";

	/**
	 * 冻结
	 */
	public final static String ACCOUNTSYSTEMSPECIALREGISTER_FREEZE = "01";

	/**
	 * 解冻结
	 */
	public final static String ACCOUNTSYSTEMSPECIALREGISTER_FREEZE_FREE = "11";
	
	@Column(name = "TranType", nullable = false)
	public String getTranType() {
		return TranType;
	}

	public void setTranType(String tranType) {
		TranType = tranType;
	}

	/**
	 * 操作员ID
	 */
	private BigInteger OperId = null;
	
	@Column(name = "OperId", nullable = true)
	public BigInteger getOperId() {
		return OperId;
	}

	public void setOperId(BigInteger operId) {
		OperId = operId;
	}

	/**
	 * 备注
	 */
	private String Remark = null;
	
	@Column(name = "Remark", nullable = true)
	public String getRemark() {
		return Remark;
	}

	public void setRemark(String remark) {
		Remark = remark;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;

		result = prime * result
				+ ((this.getRegSeqNo() == null) ? 0 : this.getRegSeqNo().hashCode());
		result = prime * result
				+ ((this.getMasterAccNo() == null) ? 0 : this.getMasterAccNo().hashCode());

		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof AccountSystemSpecialRegister))
			return false;
	
		AccountSystemSpecialRegister other = (AccountSystemSpecialRegister) obj;
		
		if ( !PCPSUtil.compareObject(this.getRegSeqNo(), other.getRegSeqNo()))
			return false;

		return PCPSUtil.compareObject(this.getMasterAccNo(), other.getMasterAccNo());
	}
}
